import { defineStore } from 'pinia';

const useCounter = defineStore('user', {
    state: () => ({
        username: '',
        password: '',
    }),
    getters: {
        isLoginIn: (state) => !state.username,
    },
    actions: {
        // 登录
        setCredentials(username: string, password: string) {
            this.username = username;
            this.password = password;
        },
        // 登出
        clearLogout() {
            this.username = '';
            this.password = '';
        },
    },
});

export default useCounter;
